"""
后处理器
"""

from abc import abstractmethod


class MixinResponsePostProcessor:
    """
    response的自定义后处理
    原则是进入response阶段, 对象字段变更已经不会影响应用程序了
    """
    _post_process_response_: bool

    def post_process_response(self, **kargs):
        if not hasattr(self, '_post_process_response_'):
            self._post_process_response_ = True
            self._do_post_process_response(**kargs)

    @abstractmethod
    def _do_post_process_response(self, **kargs):
        raise NotImplementedError
